<div class="panes_vertical" style="width: 700px;">
	<div class="box">	
		<form method="post" action="<{$APPLICATION_URL}>/Admin/Groupon/edit" name="frmForm" enctype="multipart/form-data">
			<fieldset>
				<legend>Sửa groupon</legend>
				<{if !empty($msg)}>
				<p>
					<div class="<{if $isError}>error<{else}>success<{/if}>">
						<{$msg}>					
					</div>
				</p>			
				<{/if}>									
				<p>
					<label>Tên:</label>
					<input type='text' id='title' name='groupon_name' value='<{$groupon->groupon_name}>' class="textfield" style="width: 50%;" max-length="255">					
				</p>
				<p>
					<label>Tiêu đề:</label>
					<input type='text' id='title' name='title' value='<{$groupon->title}>' class="textfield" style="width: 50%;" max-length="255">					
				</p>
				<p>
                    <label>Nhà cung cấp:</label>
                    <select name="supplier_id" id="supplier_id">
                        <option value=''>-- Chọn --</option>
                        <{foreach name=outer item=item from=$arrSupList}>
                        <option value="<{$item->id}>" <{if $groupon->supplier_id == $item->id}> selected="selected" <{/if}>><{$item->supplier_name}></option>
                        <{/foreach}>
                    </select>
                </p>
                <p>
                    <label>Thể loại:</label>
                    <select name="category_id" id="category_id">
                        <option value=''>-- Chọn --</option>
                        <{foreach name=outer item=cat from=$arrCatList}>
                        <option value="<{$cat->id}>" <{if $groupon->category_id == $cat->id}> selected="selected" <{/if}>><{$cat->name}></option>
                        <{/foreach}>
                    </select>
                </p>
				<p>
					<label>Giới thiệu:</label>
					<textarea name="description" id="body" cols="30" rows="12"><{$groupon->description}></textarea>					
				</p>
				<p>
					<label>Điểm nổi bật:</label>
					<textarea name="hightlight" id="body" cols="30" rows="12"><{$groupon->hightlight}></textarea>					
				</p>
				
				<p>
					<input type="hidden" name="id" value="<{$groupon->id}>" />
					<input type="submit" name="save" class="button" id="save" value=" Cập nhật "/>
				</p>
			</fieldset>
		</form>
	</div>
</div>

<script type="text/javascript">
    function formSubmit()
    {
    	var theform = document.frmForm;
    	
    	// Check Name
    	var name = theform.name.value;
    	if (name == ''){
			alert('Name is invalid');
			theform.name.focus();
			return false;
    	} 	

    	// Check status
    	var status = theform.status.value;
    	if (status == ''){
			alert('Status is invalid');
			theform.status.focus();
			return false;
    	}

    	theform.actionForm.value = 'submit';
    	theform.submit();
    	return true;
    }


</script>
<script type="text/javascript" src="<{$APPLICATION_URL}>/Libraries/External/fckeditor/fckeditor.js"></script>
<script type="text/javascript">
<!--
/*
var sToolbar;
var oFCKeditor = new FCKeditor('news_body');
oFCKeditor.BasePath = "./include/fckeditor/";
var sSkinPath = 'skins/silver/'; 	                  

oFCKeditor.Config["CustomConfigurationsPath"] = "../../js/blog_fckconfig.js";
oFCKeditor.Config["DefaultLanguage"] = "{$language_code}";
oFCKeditor.Config['AutoDetectLanguage'] = false;
oFCKeditor.Height = "300";
oFCKeditor.Width = "502";
oFCKeditor.ToolbarSet = "se_blog";

oFCKeditor.Config['SkinPath'] = sSkinPath;
oFCKeditor.ReplaceTextarea() ;
//FCKeditor.ReplaceAllTextareas();
*/
	var textareaToEditor = function( textarea )
	{
		var editor = new FCKeditor( textarea.name ) ;
	
		//editor.Width = Math.max( textarea.offsetWidth, FCKeditor.MinWidth ) ;
		//editor.Height = Math.max( textarea.offsetHeight, FCKeditor.MinHeight ) ;
		editor.BasePath = "<{$APPLICATION_URL}>/Libraries/External/fckeditor/";
		editor.Config["CustomConfigurationsPath"] = "<{$APPLICATION_URL}>/Libraries/External/fckeditor/blog_fckconfig.js";
     	editor.Config["DefaultLanguage"] = "en";
    	editor.Config['AutoDetectLanguage'] = false;
    	editor.Height = "500";
    	editor.Width = "100%";
    	//editor.ToolbarSet = "se_blog";
    
    	editor.Config['SkinPath'] = 'skins/silver/';
		return editor ;
	};
	
	FCKeditor.ReplaceAllTextareas = function()
	{
		var textareas = document.getElementsByTagName( 'textarea' ) ;

		for ( var i = 0 ; i < textareas.length ; i++ )
		{
			var editor = null ;
			var textarea = textareas[i] ;
			var name = textarea.name ;

			// The "name" attribute must exist.
			if ( !name || name.length == 0 )
				continue ;

			if ( typeof arguments[0] == 'string' )
			{
				// The textarea class name could be passed as the function
				// parameter.

				var classRegex = new RegExp( '(?:^| )' + arguments[0] + '(?:$| )' ) ;

				if ( !classRegex.test( textarea.className ) )
					continue ;
			}
			else if ( typeof arguments[0] == 'function' )
			{
				// An assertion function could be passed as the function parameter.
				// It must explicitly return "false" to ignore a specific <textarea>.
				editor = textareaToEditor( textarea ) ;
				if ( arguments[0]( textarea, editor ) === false )
					continue ;
			}

			if ( !editor )
				editor = textareaToEditor( textarea ) ;

			editor.ReplaceTextarea() ;
		}
	};	                  
	FCKeditor.ReplaceAllTextareas();
//-->
</script>